from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

from common.Utils import ExamDriver


class ExamGuide:
    url = ""
    driver = ""
    def __init__(self):
        self.driver = ExamDriver.driver
        self.url = "https://gms.test.tgtrain.cn/"
        self.driver.get(self.url)

    #导航流程
    def ExamGuideSuc(self):
        username_password_suc = WebDriverWait(self.driver, 10).until(
            EC.visibility_of_element_located((By.CSS_SELECTOR,
                                              "#app > div.head.fixed > div > div.nav > ul > li.ant-menu-overflow-item.ant-menu-item.ant-menu-item-selected.ant-menu-item-only-child > span > a"))
        )

        self.driver.find_element(By.CSS_SELECTOR,"app > div.head.fixed > div > div.nav > ul > li.ant-menu-overflow-item.ant-menu-item.ant-menu-item-selected.ant-menu-item-only-child > span > a").click()
        self.driver.find_element(By.CSS_SELECTOR,"#app > section > div.bg-wrap > section > div.nav > div > div > div > ul > div:nth-child(2) > li:nth-child(4) > div").click()
        self.driver.find_element(By.CSS_SELECTOR,"#app > section > div.bg-wrap > section > div.content > div > div.ant-spin-nested-loading > div > div > div.content.list > div:nth-child(3) > div > div.btns > div").click()
        self.driver.find_element(By.CSS_SELECTOR,"#app > section > section.mod-1 > div.content > div.bottom > div.btn > button")